The ggggeeeettttnnnnaaaammmmeeeeiiiinnnnffffoooo function is defined for protocol-independent
address-to-nodename translation. Its functionality is a reverse
conversion of ggggeeeettttaaaaddddddddrrrriiiinnnnffffoooo((((3333)))),,,, and implements such functionality by
calling ggggeeeetttthhhhoooossssttttbbbbyyyyaaaaddddddddrrrr((((3333NNNN)))) and ggggeeeettttsssseeeerrrrvvvvbbbbyyyyppppoooorrrrtttt((((3333NNNN)))),,,, in a more sophisticated
manner.
This function looks up an IP address and port number provided by the
caller in the DNS and system-specific database, and returns text strings
for both in buffers provided by the caller. The function indicates
successful completion by a zero return value; a non-zero return value
indicates failure.
The first argument, _s_a, points to either a ssssoooocccckkkkaaaaddddddddrrrr____iiiinnnn structure (for
IPv4) or a ssssoooocccckkkkaaaaddddddddrrrr____iiiinnnn6666 structure (for IPv6) that holds the IP address
and port number. The _s_a_l_e_n argument gives the length of the ssssoooocccckkkkaaaaddddddddrrrr____iiiinnnn
or ssssoooocccckkkkaaaaddddddddrrrr____iiiinnnn6666 structure.
If the socket address structure contains IPv6 unspecified address ("::"),
a lookup is not performed, and the [EAI_NONAME] error is returned.
If the argument _n_o_d_e is non-NULL and the argument _n_o_d_e_l_e_n is nonzero,
then the argument _n_o_d_e points to a buffer able to contain up to _n_o_d_e_l_e_n
characters that will receive the node name as a null-terminated string.
If the argument _n_o_d_e is NULL or the argument _n_o_d_e_l_e_n is zero, the node
name will not be returned. If the node's name cannot be located, the
numeric form of the node's address is returned instead of its name.
If the argument _s_e_r_v is non-NULL and the argument _s_e_r_v_l_e_n is nonzero,
then the argument _s_e_r_v points to a buffer able to contain up to _s_e_r_v_l_e_n
characters that will receive the service name as a null-terminated
string. If the argument _s_e_r_v is NULL or the argument _s_e_r_v_l_e_n is zero,
the service name will not be returned. If the service name cannot be
located, the numeric form of the service address (for example, its port